﻿@model IEnumerable<HelloMinasan.Domain.SongReport>

<script>
    function DeleteSongReport(pid) {
        if (confirm("Do you want to delete product?")) {
            var data = { 'Id': pid }
            $.post('/Report/Delete', data,
            function (data) {
                if (data == true)
                    location = location.href;
                else
                    alert("Could not delete");
            });
        }
    }
</script>

<table class="tableSearch" width="100%" cellspacing="0">
    <thead>
        <th></th>
        <th style="width:30px;padding-left:5px;"></th>
        <th>Song name</th>
        <th>Report comment</th>
        <th>Reporter</th>
        <th></th>
    </thead>
    <tbody>
        @if (Model.Any())
        {
            foreach (var item in Model)
            {
                <tr>
                   <td style= "width: 5%">
                      <a href="#" onclick="DeleteSongReport(@item.ID)" title="Delate">
                          <img src="~/Content/Images/report_delete.png" />
                      </a>
                    </td>
                    <td><img src="@item.Song.Images" width="30" height="40" /></td>
                    <td class="titleNewFont fontbold"><a href="/Song/Songs/@item.Song.Id">@item.Song.SongName</a></td>
                    <td>@item.ReportComment</td>
                    <td><a href="/Account/UserInformation/@item.User.Username"><b>@item.User.Username</b></a></td>
                    <td>
                        <button class="buttonClass">
                            <a href="@Url.Action("SongReport", "Report", new { id= @item.SongID , currentpage=1})">
                                View Detail
                            </a>
                        </button>
                    </td>
                </tr>
            }
            <tr>
                <td colspan="6">
                    <a style="float:right" href="@Url.Action("GetReportAll", "Report", new{type= "1", number = 1})">
                        <div>
                            <img src="@Url.Content("~/Content/Images/LoadAll.png")" width="20" height="20"/>
                            <span class="titleNewFont" style="font-size: 13px; font-weight: normal">All</span>
                        </div>
                    </a>
                </td>
            </tr>
        }
        else
        {
            <tr>
                <td colspan="5">There is no report</td>
            </tr>
        }
    </tbody>
</table>


